import utils from "core/utils/utils";
import { ItemModel } from "./itemModel";
import { PartnerModel } from "./partnerModel";

export class TeamModel {
    list: PartnerModel[]
    teamList: number[]
    frontTeamList:number[]
    recruitList: any
    frontRecruitList: any
    partnerIndexID: number
    battleSpeed: number[]
    lockList: any
    lockherotid: number //临时解锁英雄id
    constructor(opts: any = {}) {
        this.list = opts.list || []
        this.list.forEach((partner, i, array) => {
            if (partner) {
                array[i] = new PartnerModel(partner)
            }
        })
        this.teamList = opts.teamList || []
        this.frontTeamList = opts.frontTeamList || []
        this.recruitList = opts.recruitList || {}
        utils.entries(this.recruitList).forEach((item, i) => {
            let tid = item[0]
            let partner = item[1] as PartnerModel
            if (partner) {
                this.recruitList[tid] = new PartnerModel(partner)
            }
        })
        this.frontRecruitList = opts.frontRecruitList || {}
        utils.entries(this.frontRecruitList).forEach((item, i) => {
            let tid = item[0]
            let partner = item[1] as PartnerModel
            if (partner) {
                this.frontRecruitList[tid] = new PartnerModel(partner)
            }
        })
        this.partnerIndexID = opts.partnerIndexID || 1
        this.battleSpeed = opts.battleSpeed || []
        this.lockList = opts.lockList || {}
        this.lockherotid = opts.lockherotid || null
    }

}
export class ParnterPetsModel {
    petOn: ItemModel
    petsInAltar: ItemModel[]
    constructor(opts: any = {}) {
        this.petOn = opts.petOn || null
        this.petsInAltar = opts.petsInAltar || [null, null, null, null, null, null, null, null, null, null, null, null]
    }

}
